package ui;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.Font;
import java.awt.BorderLayout;

/**
 * <p>Title: TomAudioPlayer</p>
 *
 * <p>Description: a audio player powered by Java Media Framework </p>
 *
 * <p>Copyright: Copyright (c) 2005 IamCoolTom Software Corporation. All Rights
 * Reserved</p>
 *
 * <p>Company: IamCoolTom Software Corporation</p>
 *
 * @author ShanboLi
 * @version 1.0
 */
public class MainFrame_AboutBox
    extends JDialog implements ActionListener {
  private JPanel 	panel1 		= new JPanel();
  private JPanel 	panel2 		= new JPanel();
  private JPanel 	insetsPanel1 	= new JPanel();
  private JPanel 	insetsPanel2 	= new JPanel();
  private JPanel 	insetsPanel3 	= new JPanel();
  private JButton 	button1 	= new JButton();
  private JLabel 	imageLabel 	= new JLabel();
  private JLabel 	label1 		= new JLabel();
  private JLabel 	label2 		= new JLabel();
  private JLabel 	label3 		= new JLabel();
  private JLabel 	label4 		= new JLabel();
  private ImageIcon 	image1 		= new ImageIcon();
  private BorderLayout 	borderLayout1 	= new BorderLayout();
  private BorderLayout 	borderLayout2 	= new BorderLayout();
  private FlowLayout 	flowLayout1 	= new FlowLayout();
  private GridLayout 	gridLayout1 	= new GridLayout();
  private String 	product 	= "JXChat2";
  private JLabel 	jLabel1 	= new JLabel();
  private JLabel 	jLabel2 	= new JLabel();

  public MainFrame_AboutBox(Frame parent) {
    super(parent);
    try {
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      jbInit();
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  public MainFrame_AboutBox() {
    this(null);
  }

  /**
   * Component initialization.
   *
   * @throws java.lang.Exception
   */
  private void jbInit() throws Exception {
    try {
      image1 = new ImageIcon("./ui/images/about.png");

    }
    catch (Exception ex) {

    }
    imageLabel.setIcon(image1);
    setTitle("About");
    panel1.setLayout(borderLayout1);
    panel2.setLayout(borderLayout2);
    insetsPanel1.setLayout(flowLayout1);
    insetsPanel2.setLayout(flowLayout1);
    insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    gridLayout1.setRows(6);
    gridLayout1.setColumns(1);
    label1.setFont(new java.awt.Font("Comic Sans MS", Font.PLAIN, 16));
    label1.setText(product);
    label2.setFont(new java.awt.Font("Comic Sans MS", Font.PLAIN, 16));
    label2.setText("version 2.6.2");
    label3.setFont(new java.awt.Font("Comic Sans MS", Font.PLAIN, 16));
    label3.setText("Copyright (c) 2007 Shanbo Li");
    label4.setFont(new java.awt.Font("Comic Sans MS", Font.PLAIN, 16));
    label4.setText("Email: shanboli@mac.com");
    insetsPanel3.setLayout(gridLayout1);
    insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10));
    button1.setText("OK");
    button1.addActionListener(this);
    jLabel1.setFont(new java.awt.Font("Comic Sans MS", Font.PLAIN, 16));
    jLabel1.setText("All Rights Reserved.");
    jLabel2.setFont(new java.awt.Font("Comic Sans MS", Font.PLAIN, 16));
    jLabel2.setText("http://code.google.com/p/jxchat2/");
    insetsPanel2.add(imageLabel, null);
    panel2.add(insetsPanel2, BorderLayout.WEST);
    getContentPane().add(panel1, null);
    insetsPanel3.add(label1, null);
    insetsPanel3.add(label2, null);
    insetsPanel3.add(label3, null);
    insetsPanel3.add(jLabel1);
    insetsPanel3.add(jLabel2);
    insetsPanel3.add(label4, null);
    this.getContentPane().add(insetsPanel1, java.awt.BorderLayout.SOUTH);
    insetsPanel1.add(button1, null);
    panel2.add(insetsPanel3, BorderLayout.CENTER);
    panel1.add(panel2, BorderLayout.NORTH);
    setResizable(true);
  }

  /**
   * Close the dialog on a button event.
   *
   * @param actionEvent ActionEvent
   */
  public void actionPerformed(ActionEvent actionEvent) {
    if (actionEvent.getSource() == button1) {
      dispose();
    }
  }
}
